import Vue from 'vue'
import VueRouter from 'vue-router'
import store from '@/store/index'
import {constantRouterMap} from './config.router'

Vue.use(VueRouter)


const router = new VueRouter({
  base: process.env.BASE_URL,
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap
})

router.selfaddRoutes = function (params){
  router.matcher = new VueRouter().matcher;
  router.addRoutes(params)
}

export default router


